package com.baby.routing;


import com.baby.utils.ConnectionUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer {

    public static void main(String[] args) throws IOException, TimeoutException {
        //获取对象
        Connection connection = ConnectionUtil.getConnection();
        //获取通道
        Channel channel = connection.createChannel();
        //3.创建路由器
        channel.exchangeDeclare("routing_exchange","direct");
        //4.发布消息
        channel.basicPublish("routing_exchange","info",null,"路由模式。。。".getBytes());
        //5.释放资源
        channel.close();
        connection.close();
    }

}
